cmake_minimum_required(VERSION 3.15)

project(gmi_test)

file(GLOB test_sources CONFIGURE_DEPENDS
    ${CMAKE_SOURCE_DIR}/source/*.c
)

add_executable(${PROJECT_NAME}
    ${PROJECT_SOURCE_DIR}/test_main.c
    ${CMAKE_SOURCE_DIR}/third_party/unity/unity.c
    ${CMAKE_SOURCE_DIR}/third_party/cmock/cmock.c
    ${test_sources}
)

target_include_directories(${PROJECT_NAME}
    PUBLIC ${CMAKE_SOURCE_DIR}/third_party/unity
    PUBLIC ${CMAKE_SOURCE_DIR}/third_party/cmock
    PUBLIC ${CMAKE_SOURCE_DIR}/include
)

add_custom_target(test
    COMMAND $<TARGET_FILE:${PROJECT_NAME}>
)